﻿package  
{
	import flash.display.MovieClip;
	import flash.display.Shape;
	
	/**
	 * ...
	 * @author 
	 */
	public dynamic class Charts extends MovieClip  
	{
		public var charts:MovieClip = new MovieClip();
		public const padding = 15;
		public function Charts() 
		{
			drawView(500,250);
		}
		public function drawView(stageWidth:Number,stageHeight:Number) {
			trace(this.numChildren,stage.stageWidth);
			//var child:Shape = new Shape();
            charts.graphics.beginFill(0xcccccc,0.2);
            charts.graphics.lineStyle(1, 0x990000,.45);
            charts.graphics.drawRect(0, 0, stageWidth, stageHeight);
            charts.graphics.endFill();
			//开始坐标轴
			charts.graphics.lineStyle(1.2, 0x666666);
			charts.graphics.moveTo(0+padding, charts.height-padding);
			charts.graphics.lineTo(charts.width - padding, charts.height - padding);
			
			charts.graphics.moveTo(0+padding, charts.height-padding);
			charts.graphics.lineTo( padding,  padding);
			//开始水平箭头
			var AW:Number = 12, AH:Number = 4, AHin = 4, 
			aX = charts.width - padding, aY = charts.height - padding,
			arrLeftOffset:Number=AW-AHin;
			//charts.graphics.beginFill(0x666666,0.5);
			charts.graphics.moveTo (aX - AH, aY -AH);
			charts.graphics.lineTo (aX + AW, aY);
			charts.graphics.lineTo (aX - AH, aY +AH);
			charts.graphics.lineTo (aX, aY);
			charts.graphics.lineTo (aX - AH, aY -AH);
			//charts.graphics.endFill();
			//开始垂直箭头
			charts.graphics.beginFill(0x0099cc,0.9);
			charts.graphics.moveTo (padding - AH, padding+AH);
			charts.graphics.lineTo (padding, padding - AW+AH);
			charts.graphics.lineTo (padding + AH, padding+AH);
			charts.graphics.lineTo (padding, padding - AH+AH);
			charts.graphics.lineTo (padding - AH, padding + AH);
			charts.graphics.endFill();
			 
			
			//charts.graphics.lineTo(charts.width - padding + AHin, (charts.height - padding) - AH + (AH / 2) ); //   \
			//charts.graphics.moveTo(charts.width - padding		, (charts.height - padding)-AH);
			
			
			
			charts.x = (stage.stageWidth-charts.width)/2;
			charts.y = (stage.stageHeight - charts.height) / 2;
			
			addChild(charts);
			
			
			trace(this.numChildren);
		}
	}
	
}